Xbasic

OBJECT.CLASS Function

Syntax

Object_Type as C = .Class()

Description

Returns the class of the object.

Discussion

The <OBJECT>.CLASS() method applies to:

Alpha Anywhere (for <OBJECT> use the keyword "A5")
Control Panel (for <OBJECT> use the keyword "CONTROLPANEL")
Browses (for <OBJECT> use either the <BROWSE> pointer or the name of the browse)
Dictionary (for <OBJECT> use the <DICTIONARY> pointer)
File Lists (for <OBJECT> use the <FILE_LIST> pointer)
Form Controls (for <OBJECT> use the <CONTROL> pointer or the address of the control)
Indexes (for <OBJECT> use the <INDEX> pointer)
Table Fields (for <OBJECT> use the <FIELD> pointer)

The <OBJECT>.CLASS() method returns the class (i.e., type) of the object.

Example

Assume a form called F1 has a field called City and a button called Button1.

? :F1.class()
= "Form"
? :F1:city.class()
= "Field"
? :F1:button1.class()
= "Button"

The following example returns the class of a table field.

dim ptr as P
dim tptr as P
dim fptr as P
ptr = form.load("Customer Information")
ptr.show()
tptr = Table.current()
fptr = tptr.field_get(2)
? fptr.class()
= "Field"

The following example returns the class of a form field named lastname.

dim ptr as P
ptr = form.load("Customer Information")
ptr.show()
? ptr.lastname.class()
= "type-in field"

Limitations

Desktop applications only.

See Also